package leetcode100;

import bin_tree.leetcode.TreeNode;

/**
 * @author shkstart
 * 二叉树的镜像
 * @create 2022-12-20-22:48
 */
public class Meme17_2 {
    public TreeNode Mirror (TreeNode pRoot) {
        // write code here
        if(pRoot==null){
            return pRoot;
        }else if(pRoot.left==null&&pRoot.right==null){
            return pRoot;
        }else{
            TreeNode temp = pRoot.left;
            pRoot.left = pRoot.right;
            pRoot.right = temp;

            Mirror(pRoot.left);
            Mirror(pRoot.right);
            return pRoot;
        }
    }
}
